##开启事务
BEGIN;
SET NAMES utf8mb4;

-- ------------------------> 正式开始写 SQL 语句 <------------------------
-- ----------------------------
-- 禁止访问IP 表
-- ----------------------------
DROP TABLE IF EXISTS `ban_address`;
CREATE TABLE `ban_address`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `address`     varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '访问IP',
    `is_deleted`  tinyint(1)                                                   NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '禁止访问IP'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 数据字典 表
-- ----------------------------
DROP TABLE IF EXISTS `dic_info`;
CREATE TABLE `dic_info`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `parent_id`   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '-1' COMMENT '父级ID',
    `dic_name`    varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '字典名称',
    `dic_value`   int                                                          NULL     DEFAULT NULL COMMENT '字典值',
    `dic_sort`    int                                                          NULL     DEFAULT NULL COMMENT '字典顺序',
    `is_show`     tinyint(1)                                                   NOT NULL DEFAULT 1 COMMENT '是否显示',
    `predefined`  tinyint(1)                                                   NULL     DEFAULT 0 COMMENT '预定义(true-是, false-否)',
    `is_deleted`  tinyint(1)                                                   NULL     DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '数据字典'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 邮件发送记录 表
-- ----------------------------
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info`
(
    `id`            varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `receive_add`   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '接收地址',
    `email_title`   varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮件标题',
    `email_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci         NULL COMMENT '邮件内容',
    `send_time`     datetime                                                      NOT NULL COMMENT '发送时间',
    `send_user_id`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '发送用户',
    `template_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '模版code',
    `send_error`    tinyint(1)                                                    NULL DEFAULT NULL COMMENT '消息发送异常：1(异常) 0(正常)',
    `error_msg`     text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci         NULL COMMENT '错误内容',
    `is_deleted`    tinyint(1)                                                    NOT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`   datetime                                                      NULL DEFAULT NULL COMMENT '创建时间',
    `update_time`   datetime                                                      NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '邮件发送记录'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 邮件模版 表
-- ----------------------------
DROP TABLE IF EXISTS `email_template`;
CREATE TABLE `email_template`
(
    `id`               varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `template_code`    varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '模版code',
    `template_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci         NULL COMMENT '邮件内容模版',
    `msg_title`        varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消息标题',
    `is_deleted`       tinyint(1)                                                    NOT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`      datetime                                                      NULL DEFAULT NULL COMMENT '创建时间',
    `update_time`      datetime                                                      NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `email_template_template_code_uindex` (`template_code` ASC) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '邮件模版'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 消费账单 表
-- ----------------------------
DROP TABLE IF EXISTS `expense_bill`;
CREATE TABLE `expense_bill`
(
    `id`              varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `shop_id`         varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '店铺ID',
    `member_id`       varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '会员ID',
    `expense_item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '消费项目ID',
    `bill_time`       datetime                                                      NULL     DEFAULT NULL COMMENT '账单时间',
    `original_price`  decimal(10, 2)                                                NULL     DEFAULT NULL COMMENT '原价',
    `discount`        decimal(5, 2)                                                 NULL     DEFAULT NULL COMMENT '折扣',
    `final_price`     decimal(10, 2)                                                NULL     DEFAULT NULL COMMENT '最终价格',
    `remark`          varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '备注',
    `is_deleted`      tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`     datetime                                                      NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`     datetime                                                      NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '账单表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 消费项目 表
-- ----------------------------
DROP TABLE IF EXISTS `expense_item`;
CREATE TABLE `expense_item`
(
    `id`            varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `shop_id`       varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '店铺ID',
    `item_name`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '消费项目',
    `default_price` decimal(10, 2)                                                NULL     DEFAULT NULL COMMENT '默认价格',
    `sort_number`   int                                                           NULL     DEFAULT NULL COMMENT '顺序编号(越小越靠前)',
    `preset_flag`   tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '是否预置',
    `remark`        varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '备注',
    `is_deleted`    tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`   datetime                                                      NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`   datetime                                                      NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '消费项目表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 文件上传记录 表
-- ----------------------------
DROP TABLE IF EXISTS `file_upload`;
CREATE TABLE `file_upload`
(
    `id`               varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   NOT NULL COMMENT '数据主键ID',
    `old_file_name`    varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '原文件名',
    `new_file_name`    varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '新文件名',
    `upload_time`      datetime                                                       NULL     DEFAULT NULL COMMENT '文件上传时间',
    `upload_user_id`   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   NULL     DEFAULT NULL COMMENT '文件上传用户ID',
    `upload_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   NULL     DEFAULT NULL COMMENT '文件上传用户名',
    `bucket_name`      varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT 'Minio存储文件桶',
    `download_url`     varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '文件下载地址',
    `is_deleted`       tinyint(1)                                                     NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`      datetime                                                       NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`      datetime                                                       NULL     DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '文件上传记录表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- IP查询记录 表
-- ----------------------------
DROP TABLE IF EXISTS `ip_query_info`;
CREATE TABLE `ip_query_info`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `ip`          varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'IP地址',
    `country`     varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '国家中文名称',
    `province`    varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '中国省份中文名称',
    `address`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '详细地址',
    `isp`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '互联网服务提供商',
    `overseas`    tinyint(1)                                                    NULL DEFAULT NULL COMMENT '是否国外 true-是, false-否',
    `lat`         decimal(12, 8)                                                NULL DEFAULT NULL COMMENT '纬度',
    `lng`         decimal(12, 8)                                                NULL DEFAULT NULL COMMENT '经度',
    `is_deleted`  tinyint(1)                                                    NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                      NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                      NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `ip_query_info_ip_uindex` (`ip` ASC) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = 'IP查询记录'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 拦截器访问记录 表
-- ----------------------------
DROP TABLE IF EXISTS `log_info`;
CREATE TABLE `log_info`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `uri`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '访问uri',
    `access_time` datetime                                                      NULL DEFAULT NULL COMMENT '访问时间',
    `access_ip`   varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '访问IP',
    `session_id`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT 'sessionId',
    `user_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '用户ID',
    `reject`      tinyint(1)                                                    NULL DEFAULT NULL COMMENT '是否拒绝访问 true-是, false-否',
    `is_deleted`  tinyint(1)                                                    NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                      NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                      NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '拦截器访问记录'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 会员 表
-- ----------------------------
DROP TABLE IF EXISTS `member_info`;
CREATE TABLE `member_info`
(
    `id`           varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `shop_id`      varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '店铺ID',
    `member_no`    varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '会员号',
    `member_name`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '会员名',
    `member_phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '会员手机号',
    `balance`      decimal(10, 2)                                               NOT NULL DEFAULT 0.00 COMMENT '账户余额',
    `discount`     decimal(5, 2)                                                NOT NULL DEFAULT 100.00 COMMENT '折扣',
    `version`      int                                                          NOT NULL DEFAULT 1 COMMENT '数据版本',
    `status`       tinyint(1)                                                   NOT NULL DEFAULT 1 COMMENT '会员状态(-1: 未知, 1:启用, 2:冻结 )',
    `is_deleted`   tinyint(1)                                                   NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`  datetime                                                     NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`  datetime                                                     NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '会员表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 店铺基本信息 表
-- ----------------------------
DROP TABLE IF EXISTS `my_shop`;
CREATE TABLE `my_shop`
(
    `id`                  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `shop_name`           varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '店铺名称',
    `shop_address`        text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci        NULL COMMENT '店铺地址',
    `shop_phone`          varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '店铺电话',
    `shop_code`           varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '店铺邀请码',
    `opening_hours_start` time                                                         NULL DEFAULT NULL COMMENT '开始营业时间',
    `opening_hours_end`   time                                                         NULL DEFAULT NULL COMMENT '结束营业时间',
    `shop_manager_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '店长ID(店铺管理员)',
    `is_deleted`          tinyint(1)                                                   NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`         datetime                                                     NULL DEFAULT NULL COMMENT '创建时间',
    `update_time`         datetime                                                     NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '店铺基本信息'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 系统公告 表
-- ----------------------------
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice`
(
    `id`              varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `send_time`       datetime                                                     NOT NULL COMMENT '发送时间',
    `receive_user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '接收用户ID',
    `read_flag`       tinyint(1)                                                   NOT NULL DEFAULT 0 COMMENT '阅读标记(0-否, 1-是)',
    `read_time`       datetime                                                     NULL     DEFAULT NULL COMMENT '阅读时间',
    `content`         longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci    NULL COMMENT '公告内容',
    `handle_flag`     tinyint(1)                                                   NOT NULL DEFAULT 0 COMMENT '处理标记(0-未处理, 1-用户处理, 2-系统处理)',
    `is_deleted`      tinyint(1)                                                   NULL     DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`     datetime                                                     NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`     datetime                                                     NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '系统公告'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 外部请求记录 表
-- ----------------------------
DROP TABLE IF EXISTS `req_without_info`;
CREATE TABLE `req_without_info`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `url`         longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci    NULL COMMENT '请求url',
    `req_header`  longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci    NULL,
    `req_body`    longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci    NULL COMMENT '请求对象',
    `req_time`    datetime                                                     NULL DEFAULT NULL COMMENT '请求时间',
    `resp_flag`   tinyint(1)                                                   NULL DEFAULT NULL COMMENT '响应标记(0-false, 1-true)',
    `resp_result` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci    NULL COMMENT '响应结果',
    `resp_time`   datetime                                                     NULL DEFAULT NULL COMMENT '响应时间',
    `is_deleted`  tinyint(1)                                                   NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '外部请求记录'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 资源信息 表(权限管控未启用, 该表处于未维护状态)
-- ----------------------------
DROP TABLE IF EXISTS `res_info`;
CREATE TABLE `res_info`
(
    `id`            varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `parent_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL DEFAULT '-1' COMMENT '父级ID',
    `res_uri`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '资源uri',
    `function_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '功能名称',
    `menu_name`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '菜单名称',
    `menu_code`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '菜单Code',
    `system_add`    tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '系统添加(true-是，false-否)',
    `sort_num`      int                                                           NOT NULL DEFAULT 1 COMMENT '序号',
    `is_show`       tinyint(1)                                                    NOT NULL DEFAULT 1 COMMENT '是否列表展示(true-是, false-否)',
    `is_deleted`    tinyint(1)                                                    NOT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`   datetime                                                      NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`   datetime                                                      NULL     DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '资源信息表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 角色资源关联 表(权限管控未启用, 该表处于未维护状态)
-- ----------------------------
DROP TABLE IF EXISTS `res_role`;
CREATE TABLE `res_role`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `res_id`      varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资源ID',
    `role_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID',
    `is_deleted`  tinyint(1)                                                   NOT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '角色资源关联表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 角色信息 表(权限管控未启用, 该表处于未维护状态)
-- ----------------------------
DROP TABLE IF EXISTS `role_info`;
CREATE TABLE `role_info`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `role_code`   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色Code',
    `role_name`   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '角色名称',
    `sort_num`    int                                                          NOT NULL DEFAULT 9999 COMMENT '序号',
    `predefined`  tinyint(1)                                                   NOT NULL DEFAULT 0 COMMENT '预定义(true-是, false-否)',
    `show`        tinyint(1)                                                   NOT NULL DEFAULT 1 COMMENT '是否展示(0-否, 1-是)',
    `is_deleted`  tinyint(1)                                                   NOT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL     DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `role_info_role_code_uindex` (`role_code` ASC) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '角色信息表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 店铺首页轮播图 表
-- ----------------------------
DROP TABLE IF EXISTS `swiper_shop`;
CREATE TABLE `swiper_shop`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `shop_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '店铺ID',
    `url`         text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci         NULL COMMENT 'url地址',
    `remark`      varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '备注',
    `is_deleted`  tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                      NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                      NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '店铺首页轮播图'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 系统信息 表
-- ----------------------------
DROP TABLE IF EXISTS `sys_info`;
CREATE TABLE `sys_info`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   NOT NULL COMMENT '数据ID',
    `sys_name`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '系统名称',
    `sys_desc`    varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '系统描述',
    `developer`   varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   NULL DEFAULT NULL COMMENT '开发者',
    `we_chat`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '微信号',
    `qq`          varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT 'QQ',
    `github`      varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT 'GitHub地址',
    `web_url`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL DEFAULT NULL COMMENT '网址',
    `remark`      text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci          NULL COMMENT '备注',
    `is_deleted`  tinyint(1)                                                     NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                       NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                       NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '系统信息'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 不需要鉴权的URL 表
-- ----------------------------
DROP TABLE IF EXISTS `sys_not_permission`;
CREATE TABLE `sys_not_permission`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `url_path`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '不需要鉴权的URL',
    `is_deleted`  tinyint(1)                                                    NULL DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                      NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                      NULL DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '不需要鉴权的URL'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 系统用户 表
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user`
(
    `id`              varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `login_id`        varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '登陆ID',
    `nick_name`       varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '用户昵称',
    `password`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '密码',
    `avatar`          varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '头像',
    `gender`          tinyint(1)                                                    NULL     DEFAULT 0 COMMENT '性别(性别 0-未知, 1-男, 2-女)',
    `email`           varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '电子邮件',
    `phone`           varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '电话',
    `status`          tinyint                                                       NULL     DEFAULT NULL COMMENT '状态(1-正常,2-冻结)',
    `user_type`       tinyint                                                       NULL     DEFAULT NULL COMMENT '用户类型: 1(管理员) 2(普通用户) 3(微信用户)',
    `is_show`         tinyint(1)                                                    NOT NULL DEFAULT 1 COMMENT '是否显示',
    `last_login_add`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '最后登录IP',
    `last_login_time` datetime                                                      NULL     DEFAULT NULL COMMENT '最后登录时间',
    `we_chat_id`      varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '微信账号ID',
    `call_name`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '称呼',
    `is_deleted`      tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`     datetime                                                      NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`     datetime                                                      NULL     DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `sys_user_login_id_uindex` (`login_id` ASC) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '系统用户'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 充值账单 表
-- ----------------------------
DROP TABLE IF EXISTS `top_up_bill`;
CREATE TABLE `top_up_bill`
(
    `id`              varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '数据ID',
    `shop_id`         varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '店铺ID',
    `member_id`       varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NULL     DEFAULT NULL COMMENT '会员ID',
    `first_pre_store` tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '是否首充(0-否, 1-是)',
    `top_up_price`    decimal(10, 2)                                                NULL     DEFAULT NULL COMMENT '充值金额',
    `bill_time`       datetime                                                      NULL     DEFAULT NULL COMMENT '账单时间',
    `remark`          varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '备注',
    `is_deleted`      tinyint(1)                                                    NOT NULL DEFAULT 0 COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time`     datetime                                                      NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time`     datetime                                                      NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '充值账单'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 角色用户关联 表
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `user_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID',
    `role_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID',
    `is_deleted`  tinyint(1)                                                   NOT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '角色用户关联表'
  ROW_FORMAT = Dynamic;

-- ----------------------------
-- 用户店铺关联 表
-- ----------------------------
DROP TABLE IF EXISTS `user_shop`;
CREATE TABLE `user_shop`
(
    `id`          varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据ID',
    `user_id`     varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '用户ID',
    `dic_value`   int                                                          NOT NULL DEFAULT 1007 COMMENT '职位字典值',
    `shop_code`   varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL     DEFAULT NULL COMMENT '店铺邀请码Code',
    `is_deleted`  tinyint(1)                                                   NULL     DEFAULT NULL COMMENT '逻辑删除：1(已删除) 0(未删除)',
    `create_time` datetime                                                     NULL     DEFAULT NULL COMMENT '创建时间',
    `update_time` datetime                                                     NULL     DEFAULT NULL COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '用户店铺关联表'
  ROW_FORMAT = Dynamic;
-- ------------------------> 正式结束写 SQL 语句 <------------------------
##提交事务
COMMIT;

## 如遇错误, 执行以下sql
## ROLLBACK;